<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    /* 使用条件：
    1、父元素不能overflow:hidden或者overflow:auto属性。
    2、必须指定top、bottom、left、right4个值之一，否则只会处于相对定位
    3、父元素的高度不能低于sticky元素的高度
    4、sticky元素仅在其父元素内生效 */
    .fu{
      position: relative;
      width: 400px;
      height: 600px;
      background-color: pink;
      margin: 0 auto;
      overflow: auto;
      transition: all 0.5s;
    }
    .one{
      height: 600px;
      position: absolute;
      right: 100px;
    }
    .cont{
      height: 800px;
      background-color: rgb(145, 255, 231);
    }
    .son{
      position: sticky;
      /* right: 0; */
      top: 50px;
      margin-left: 74%;
      width: 100px;
      height: 300px;
      background-color: red;
      /* transition: all 0.5s; */
    }

  </style>
</head>
<body>
  <div class="fu">
    <div class="one">
      <div class="son">导航区域</div>
    </div>
    <div class="cont">内容区域</div>
      <!-- <div class="cont">123456</div> -->
  </div>
  
  <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
  <script>
    // 滚动到父盒子到顶部
    $('.son').on('click',function () {  
      // console.log(this.offsetTop);
      console.log(this.offsetTop);
      $('.fu').animate({ scrollTop: 0 }, 100);
      // $('.fu')[0].scrollTo(0,0)
    })
  </script>
</body>
</html>